using NL.UI;
using NL;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace XGame.UI
{
    public class WinDemon : Window
    {
        public List<UISkillItem> skill_items;

        private IniArrAction _ONSkillsQuery;
        public WinDemon WaitSkillsQuery(IniArrAction _on)
        {
            _ONSkillsQuery = _on;
            return this;
        }

        protected override void OnShow()
        {
            base.OnShow();

			var arr = _ONSkillsQuery?.Invoke();

            List<NLIni> _infos = new List<NLIni>();
            _infos.AddRange(arr);

			for(int i = 0; i < _infos.Count; i++)
            {
                skill_items[i].gameObject.INFOSet(_infos[i]);
                skill_items[i].WaitClick((_id)=>{Close();return _DemonSelectSkill?.Invoke(_id);}).Show();
            }

        }

        IniAction<int> _DemonSelectSkill;
        public WinDemon WaitSelectSkill(IniAction<int> _on)
        {
            _DemonSelectSkill = _on;
            return this;
        }

        

    }
}

